<%@ page import="java.util.Map" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Arrays" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2021/1/23
  Time: 15:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>获得注册信息</title>
</head>
<body>
<%
    request.setAttribute("loginTime",new java.util.Date());
    //设置字符集
    request.setCharacterEncoding("utf-8");
    String name=request.getParameter("userName");
    String pass=request.getParameter("userPass");
    String[]likes=request.getParameterValues("like");
    String age=request.getParameter("age");
    int ia=Integer.parseInt(age);//数字，日期，文件。。。

    //ip
    String ip=request.getRemoteAddr();
    //>>>
    Map<String, String[]> parameterMap = request.getParameterMap();
    Set<Map.Entry<String, String[]>> keys = parameterMap.entrySet();
    for(Map.Entry<String, String[]> e:keys){
        System.out.println(e.getKey()+","+ Arrays.toString(e.getValue())+"<br/>");
    }
%>
<div style="height: 500px;border:5px solid green;">
    <h1>ip:<%=ip%></h1>
    <h1>用户名:<%=name%></h1>
    <h1>密码:<%=pass%></h1>
    <h1>
        爱好:
        <%
            for(int i=0;likes!=null &&i<likes.length;i++)
                out.print(likes[i]+"&nbsp;");
        %>
    </h1>
</div>
<%
    out.print("注册成功，已经是红娘网的vip了");
    out.print(",当前时间:"+request.getAttribute("loginTime"));
    //算一个请求
    request.getRequestDispatcher("/students.jsp").forward(request,response);

    //重定向
    //response.
    //response.sendRedirect("students.jsp");
%>
</body>
</html>
